﻿<cfscript>
/** 
* DataBase Frameworks - Sequence
* 
* @hint "DataBase Frameworks - Sequence - Term" 
*/ 

component 
	displayname="public.service.db.senate.sequence.Term" 
	output=false 
	accessors=true 
	{

	property type="string" name="AcademicYear" hint="教学年";
	property type="string" name="AcademicTerm" hint="学期";
	
	/**
	* @hint "初始化对象"
	*/
	public function init() output=false {
		return this;
	}
	
	/**
	* @hint "自定义主键规则"
	*/
	public string function getID() output=false {
		
		var nextID = mid(getAcademicYear(), 3, 2) & getAcademicTerm();

		/* 
			主键生成规则 
			
			学期代码3位 学年开始年份后2位 + 1位季节 1-秋季 2-春季 3-夏季

			Unique: ADADEMIC_YEAR, ACADEMIC_TERM
		*/
		return nextID;
	}

}

</cfscript>